home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1985 Winter / rerun-1985-winter.d64 / pay the bills (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  5KB  |  199 lines

  1. 100 rem  <<< check writer >>>
  2. 110 rem      wayne arnett
  3. 120 rem
  4. 130 print chr$(142)
  5. 140 f1$=chr$(133):f7$=chr$(136):rem key 1,f1$:key 7,f7$
  6. 150 dim c$(24,3),c(24):rem checks
  7. 160 dim d$(5,2),d(5):rem deposits
  8. 170 dim w$(5):rem numerals/words
  9. 180 dim m$(12):rem months
  10. 190 dim a1$(19),a2$(9)
  11. 200 for i=1to19:read a1$(i):next
  12. 210 for i=2to9:read a2$(i):next
  13. 220 for i=1to12:read m$(i):next
  14. 230 for i=1to5:for j=1to3 step2
  15. 240 read c$(i,j):nextj,i
  16. 250 rem
  17. 260 data one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve
  18. 270 data thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen
  19. 280 rem
  20. 290 data twenty,thirty,forty,fifty,sixty,seventy,eighty,ninety
  21. 300 rem
  22. 310 data jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec
  23. 320 rem
  24. 330 data mortgage company,"account #"
  25. 340 data electric company,"account #"
  26. 350 data water company,"account #"
  27. 360 data gas credit card,"account #"
  28. 370 data mastercharge,"account #"
  29. 380 rem **
  30. 390 rem *** initial format
  31. 400 rem **
  32. 410 print"[147]enter information for checks & register":print
  33. 420 input "month (1-12)";mo
  34. 430 input "day (1-31)";da$
  35. 440 input "two-digit year";yr$
  36. 450 dy$=m$(mo)+" "+da$+"      "+yr$
  37. 460 dz$=m$(mo)+" "+da$+", 19"+yr$
  38. 470 print:input"how many deposits (max 5)";nd
  39. 480 if nd>5 then470
  40. 490 if nd=0 then print:goto580
  41. 500 for i=1to nd
  42. 510 print:input"date (mmdd)";dt$
  43. 520 if len(dt$)<>4 then510
  44. 530 d$(i,1)=left$(dt$,2)+"/"+right$(dt$,2)
  45. 540 input "amount     ";d(i):rem 5 spcs
  46. 550 td=td+d(i)
  47. 560 g=d(i):gosub1750:d$(i,2)=g$
  48. 570 nexti:print"[147]"
  49. 580 g=td:gosub1750:td$=g$
  50. 590 input"beginning balance";bb
  51. 600 g=bb:gosub1750:bb$=g$
  52. 610 print:input"bank charges";bc
  53. 620 g=bc:gosub1750:bc$=g$
  54. 630 print:input"other deductions";od
  55. 640 g=od:gosub1750:od$=g$
  56. 650 print:input"first check number";fcn
  57. 660 rem **
  58. 670 rem *** set up checks
  59. 680 rem **
  60. 690 print"[147]enter information for printing checks."
  61. 700 print"to skip one, hit 'return' without"
  62. 710 print"entering any numbers."
  63. 720 cn=fcn:rc=1
  64. 730 for i=1to5
  65. 740 print:print " check no.";cn;"[157] "
  66. 750 print"payee: ";c$(i,1)
  67. 760 input"amount ";c(i)
  68. 770 if c(i)<1 then800
  69. 780 if c(i)>=10000 then760 
  70. 790 gosub890:cn=cn+1
  71. 800 nc=nc+1:nexti
  72. 810 rc=0
  73. 820 print"[147]after writing last check, hit 'return'"
  74. 830 print"without an entry for payee."
  75. 840 print:print " check no.";cn;"[157] "
  76. 850 input"payee ";c$(i,1)
  77. 860 if c$(i,1)=""then980
  78. 870 input"amount";c(i)
  79. 880 if c(i)<1 or c(i)>=10000 then870
  80. 890 tc=tc+c(i)
  81. 900 g=c(i):gosub1750:c$(i,2)=g$
  82. 910 if rc then return
  83. 920 input"memo  ";c$(i,3)
  84. 930 if len(c$(i,3))>20 then920
  85. 940 i=i+1:cn=cn+1:nc=nc+1
  86. 950 if i>24 then980
  87. 960 k=i-6:if k/4=int(k/4)then print"[147]"
  88. 970 goto840
  89. 980 g=tc:gosub1750:tc$=g$
  90. 990 eb=bb+td-bc-od-tc
  91. 1000 g=eb:gosub1750:eb$=g$
  92. 1010 rem **
  93. 1020 rem *** print checks
  94. 1030 rem **
  95. 1040 print"[147]be sure the asterisks were printed at"
  96. 1050 print"top of first check. press f1 to proceed"
  97. 1060 print"with printing.  f7 to try again."
  98. 1070 close3:cn=fcn:open3,4
  99. 1080 print#3,"*****"
  100. 1090 get r$:if r$="" then1090
  101. 1100 if r$=f1$ then1130 
  102. 1110 if r$=f7$ then1080
  103. 1120 goto1090 
  104. 1130 sp=2:gosub1780
  105. 1140 for i=1 to nc
  106. 1150 if c(i)<1 then1320
  107. 1160 print#3,tab(55);"#";cn
  108. 1170 sp=1:gosub1780
  109. 1180 print#3,tab(55)dy$
  110. 1190 c$(i,1)=left$(c$(i,1),44)
  111. 1200 for j=1 to 45-len(c$(i,1))
  112. 1210 c$(i,1)=c$(i,1)+" ":nextj
  113. 1220 sp=4:gosub1780
  114. 1230 print#3,tab(6);c$(i,1);
  115. 1240 print#3,tab(10);c$(i,2)
  116. 1250 sp=2:gosub1780
  117. 1260 gosub1810
  118. 1270 print#3,tab(6);w$
  119. 1280 sp=4:gosub1780
  120. 1290 print#3,tab(6);c$(i,3)
  121. 1300 sp=5:gosub1780
  122. 1310 cn=cn+1
  123. 1320 nexti
  124. 1330 close3
  125. 1340 rem **
  126. 1350 rem *** print register
  127. 1360 rem **
  128. 1370 print"[147] to print a summary for your records,"
  129. 1380 print" install regular paper in printer."
  130. 1390 print:print tab(13);"f1 to print"
  131. 1400 print tab(9);"f7 to exit program"
  132. 1410 get r$:if r$=""then1410
  133. 1420 if r$=f1$ then1450 
  134. 1430 if r$=f7$ then2030
  135. 1440 goto1410 
  136. 1450 open3,4
  137. 1460 print#3,chr$(14);tab(11)"checking account"
  138. 1470 print#3,tab(13);dz$;chr$(15)
  139. 1480 print#3:print#3
  140. 1490 print#3,"beginning balance";tab(50-len(bb$));bb$
  141. 1500 print#3
  142. 1510 if nd=0 then1550 
  143. 1520 fori=1to nd
  144. 1530 print#3,"deposit ";d$(i,1);tab(54-len(d$(i,2)));d$(i,2)
  145. 1540 nexti
  146. 1550 print#3
  147. 1560 print#3,"less bank charges";tab(29-len(bc$));bc$
  148. 1570 if od=0 then1590
  149. 1580 print#3:print#3,"other deductions";tab(30-len(od$));od$
  150. 1590 print#3:cn=fcn
  151. 1600 for i=1to nc
  152. 1610 if c(i)<1 then1670
  153. 1620 c$(i,1)=left$(c$(i,1),30)
  154. 1630 if cn>999 then k=7:goto1650
  155. 1640 k=8
  156. 1650 print#3,"ck#";cn;c$(i,1);tab(k-len(c$(i,2)));c$(i,2)
  157. 1660 cn=cn+1
  158. 1670 next i
  159. 1680 print#3:print#3,"*** total checks ***";tab(26-len(tc$));tc$
  160. 1690 print#3:print#3,"ending balance";tab(53-len(eb$));eb$
  161. 1700 close3:goto2030
  162. 1710 rem **
  163. 1720 rem *** subroutines
  164. 1730 rem **
  165. 1740 rem----align decimal points
  166. 1750 g$=str$(int(g))+"."+right$(str$(g*100),2)
  167. 1760 return
  168. 1770 rem----set spacing for printout
  169. 1780 for n=1 to sp:print#3:nextn
  170. 1790 return
  171. 1800 rem----convert numbers to words
  172. 1810 for j=1to5:w$(j)="":nextj
  173. 1820 q$=c$(i,2):l1=(len(q$))-1
  174. 1830 q$=right$(q$,l1):l2=l1-3
  175. 1840 ca$=mid$(q$,1,l2):ce$=right$(q$,2)
  176. 1850 m=1:on l2 goto1920,1910,1880,1860
  177. 1860 t=val(mid$(ca$,m,1))
  178. 1870 w$(1)=a1$(t)+" thousand ":m=m+1
  179. 1880 t=val(mid$(ca$,m,1)):if t=0 then1900
  180. 1890 w$(2)=a1$(t)+" hundred "
  181. 1900 m=m+1
  182. 1910 t1=val(mid$(ca$,m,1)):m=m+1
  183. 1920 t2=val(mid$(ca$,m,1))
  184. 1930 if t1=0 then1960 
  185. 1940 if t1=1 then t3=10+t2:w$(5)=a1$(t3):goto1990
  186. 1950 w$(3)=a2$(t1)
  187. 1960 if t2=0 then w$(5)=w$(3):goto1990
  188. 1970 w$(4)=a1$(t2):if t1=0 then w$(5)=w$(4):goto1990
  189. 1980 w$(5)=w$(3)+"-"+w$(4)
  190. 1990 w$=w$(1)+w$(2)+w$(5)+" and "+ce$+"/100"
  191. 2000 w$="*** "+w$+" ***"
  192. 2010 t=0:t1=0:t2=0
  193. 2020 return
  194. 2030 end
  195. 5000 input "enter #";c
  196. 5010 if int(100*c)<>100*c then5000
  197. 5020 printc,100*c
  198. 5030 goto5000
  199.